﻿<%@ Page Language="C#" AutoEventWireup="true" %>
<script runat="server">
    
    List<ModImageEntity> listItem = null;
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.ContentType = "text/xml";

        int page = HL.Core.Web.HttpQueryString.GetValue("page").ToInt(0);
        int NewsID = HL.Core.Web.HttpQueryString.GetValue("newsid").ToInt(0);

        var dbQuery = ModImageService.Instance.CreateQuery()
            .Where(o => o.NewsID == NewsID)
            .OrderByDesc(o => new {o.ID })
            .Take(3)
            .Skip(page * 3);

        listItem = dbQuery.ToList();
        
    }
    
</script>
<playlist version="1" xmlns="http://xspf.org/ns/0/">
    <trackList>
    <%for (int i = 0; listItem != null && i < listItem.Count; i++){%>
        <Item>
            <File><%=listItem[i].File.Replace("~/","/")%></File>
        </Item>
    <%}%>
    </trackList>
</playlist>
